<!-- Dom模板 -->
<template>
  <div id="box">
    <!-- 头部 -->
    <div class="header">
      <!-- iconfont -->
      <div class="top">
        <div>
          <!-- <i @click="lt" class="iconfont icon-lt"></i>
          <span>充值会员</span> -->
          <i @click="toMy" class="iconfont icon-lt"></i>
          <span>赠送好友</span>
        </div>
        <p>
          <i class="iconfont icon-sandian"></i>
          <span></span>
          <i class="iconfont icon-xiaochengxu-guanbi1"></i>
        </p>
      </div>
    </div>
    <!-- 费用详情 -->
    <ul class="priceBox" ref="priceBox">
      <li
        @click="priceEvent(index, item._span)"
        v-for="(item, index) in dataList"
        :key="index"
        class="animate__animated animate__bounceInRight"
      >
        <div :class="nowIndex == index ? 'active' : ''">
          <i
            v-if="nowIndex == index ? true : false"
            class="iconfont icon-a-bianzu2"
          ></i>
          <h3>{{ item._h3 }}</h3>
          <span>￥{{ item._span }}</span>
          <p>{{ item._p }}</p>
          <a v-if="index === 0 ? true : false">{{ item._a }}</a>
        </div>
      </li>
    </ul>
    <!-- vip特权 -->
    <div class="vipBox">
      <p>畅听VIP专属特权+活动特权</p>
      <ul>
        <li class="animate__animates animate__bounceIn">
          <div>
            <i class="iconfont icon--file-music"></i>
          </div>
          <span>畅听故事</span>
        </li>
        <li class="animate__animates animate__bounceIn">
          <div>
            <i class="iconfont icon-yinlefuhao"></i>
          </div>
          <span>无损音质</span>
        </li>
        <li class="animate__animates animate__bounceIn">
          <div>
            <i class="iconfont icon-shengyinlingshengjingyin-"></i>
          </div>
          <span>免广告</span>
        </li>
        <li class="animate__animates animate__bounceIn">
          <div>
            <i class="iconfont icon-jiangpai"></i>
          </div>
          <span>专属活动</span>
        </li>
        <li class="animate__animates animate__bounceIn">
          <div>
            <i class="iconfont icon-dianshi"></i>
          </div>
          <span>专属课程 </span>
        </li>
        <li class="animate__animates animate__bounceIn">
          <div>
            <i class="iconfont icon-liwu1"></i>
          </div>
          <span>乐李Maco蛋</span>
        </li>
      </ul>
    </div>
    <!-- 尾部价格 -->
    <div class="footer animate__animated animate__bounceInUp">
      <div class="allPrice">总计:￥<a ref="a">{{$store.getters['order/acb']}}</a></div>
      <div class="submit" @click="lt">确认支付</div>
    </div>
    <p class="friendTitle">我的好友</p>
    <div class="friend">
      <p  class="playsd"><input id="color-input-redss" type="checkbox" value="全选" v-model="checkboxs">
    <!-- <label  for="color-input-redss"></label > -->
    全部赠送会员</p>
      
      <div class="con">
        <p v-if="this.$store.state.order.delCarItem.length === 0">您现在暂无好友，请先添加好友</p>
        <div :class="item.buyType=='1'?'content reds':'content'"  v-for="(item, index) in this.$store.state.order.delCarItem" :key="index">
          <img :src="item.buyImg" />
          <a>{{item.friendlyName}}</a>
          <input  v-if="item.buyType=='0'? `${disabled}`:'' " id="color-input-red" style="" ref="play" type="checkbox" value="单选" v-model="item.flag" >
    <!-- <label  for="color-input-red"></label > -->
        </div>
      </div>
    </div>
  </div>
</template>
<script>
// import a from './a'; // 引入组件
import * as apis from "../../api/home";
export default {
  data() {
    return {
      msg: "测试",
      nowIndex: 0,
      dataList: [
        {
          _h3: "年度畅听",
          _span: "365",
          _p: "每天仅需1元",
          _a: "送线下课堂体验",
        },
        {
          _h3: "季度畅听",
          _span: "99",
          _p: "￥33/月",
        },
        {
          _h3: "月度畅听",
          _span: "38",
          _p: "￥38/月",
        },
      ],
    maney_span:365,
    };
  }, // 生命周期 - 创建完成（访问当前this实例）
  created() {}, // 生命周期 - 挂载完成（访问DOM元素）
    computed:{
      checkboxs:{
      get() {
        // console.log(this.$store.state.order.delCarItem[0])
        return this.$store.state.order.delCarItem.every(item => { return item.flag});
      },
      set(value) {
        // console.log(this);
        this.$store.state.order.delCarItem.forEach(item => {
          item.flag = value;
        });
      }
  },
  },
  mounted() {
    console.log(this.$refs['a'].innerHTML)
    this.$store.commit('order/macoNum',366)
  }, 
  // Vue方法定义
  methods: {
    lt() {
      this.$router.push({
        path: '/weChatcopy',
        query:{
          item:this.$refs['a'].innerHTML
        }
      });
    },
    priceEvent(index, text) {
      console.log(text)
      this.$store.commit('order/macoNum',text)
      this.nowIndex = index;
      this.maney_span =text
    },
    // 我的好友
    toMy() {
      this.$router.push("/my");
    },
    select(item) {   
    },
  },
};
</script>

<style scoped>
/* @import url(); 引入css类 */
@import url("../../../assets/font/iconfont.css");
#color-input-redss +label{
    display: block;
    width: 20px;
    height: 20px;
    cursor: pointer;
    position: absolute;
    top: 2px;
    left: 15px;
    background: rgba(240, 84, 77, 1);;
}

input[type="checkbox"]{
    /* width: 20px; */
    /* height: 20px; */
    border: 1px solid #000;
    border-radius: 50%;
}
#color-input-red +label{
    display: block;
    width: 20px;
    height: 20px;
    cursor: pointer;
    position: absolute;
    top: 2px;
    left: 15px;
    background: rgba(240, 84, 77, 1);;
}
#color-input-redss:checked +label::before{
    display: block;
    content: "\2714";
    text-align: center;
    font-size: 16px;
    color:green;
}
#color-input-red:checked +label::before{
    display: block;
    content: "\2714";
    text-align: center;
    font-size: 16px;
    color:pink;
}
.reds{
  color:red;
  font-size: 20px;
  font-weight: 600;
  font-family: STFangsong;
}
#box {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #f7f7f7;
  position: relative;
  z-index: 111;
}
.playsd{
position: fixed;
left:20px;
color:red;
font-size:18px;
font-weight:600;
width: 100%;
height: 30px;

background:rgb(247, 247, 247);
}
/* 头部 */
.header {
  width: 100vw;
  padding-top: 45px;
  background: white;
  padding-bottom: 24px;
}
/* iconfont */
.header .top {
  width: 100vw;
  height: 4px;
  display: flex;
  justify-content: space-between;
  padding: 0 14px;
  align-items: center;
  vertical-align: middle;
}
.header .top .icon-lt {
  font-size: 24px;
  color: #c3c3c3;
  font-weight: bold;
  vertical-align: middle;
}
.header .top div span {
  color: #101010;
  margin-left: 15px;
  font-size: 18px;
  font-weight: bold;
}
.header .top p {
  width: 87px;
  height: 32px;
  line-height: 20px;
  border-radius: 30px;
  background-color: rgba(255, 255, 255, 100);
  text-align: center;
  border: 1px solid rgba(232, 232, 232, 100);
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  vertical-align: middle;
}
.header .top p span {
  border-right: 2px solid #e8e8e8;
  display: block;
  width: 1px;
  height: 18px;
}
.header .top p .icon-sandian {
  color: #000000;
  font-size: 20px;
  font-weight: bold;
  vertical-align: middle;
}
.header .top p .icon-xiaochengxu-guanbi1 {
  color: #000000;
  font-size: 15px;
  font-weight: bold;
  vertical-align: middle;
}
/* 费用详情 */
.priceBox {
  width: 100vw;
  height: 160px;
  background: white;
  border-bottom: solid 1px #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}
.priceBox li div {
  width: 118px;
  height: 128px;
  border: solid 1px #e2e2e2;
  border-radius: 26px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.priceBox .active {
  border: solid 1px #fe0056;
}
.priceBox h3 {
  margin-top: 17px;
  margin-bottom: 5px;
  font-size: 14px;
}
.priceBox span {
  font-size: 18px;
  color: #fe0056;
  font-weight: bold;
}
.priceBox p {
  margin-top: 10px;
  font-size: 11px;
  color: #979797;
}
.priceBox a {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: #fe0056;
  font-size: 11px;
  color: white;
  line-height: 20px;
}
.priceBox i {
  position: absolute;
  top: 0;
  left: 0;
  width: 31px;
  height: 24px;
  line-height: 20px;
  border-radius: 26px 0px 26px 0px;
  background-color: rgba(254, 0, 86, 100);
  color: white;
}

/* vip特权 */
.vipBox {
  width: 100vw;
  height: 220px;
  background: white;
  padding-top: 12px;
}
.vipBox p {
  margin: 0 0 20px 20px;
  font-size: 14px;
}
.vipBox ul {
  padding: 0 5px;
  width: 100%;
  height: 145px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
}
.vipBox ul li {
  width: 33%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: left;
  margin-bottom: 20px;
}
.vipBox ul li div {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: #f0fffd 100%;
  border: solid 1px #09cfb1;
  text-align: center;
  line-height: 45px;
  margin-bottom: 5px;
}
.vipBox ul li div .iconfont {
  color: #09cfb1;
  font-size: 18px;
}
.vipBox ul li span {
  font-size: 12px;
  font-weight: 550;
}
/* 好友 */
.friend {
  width: 100vw;
  height: 200px;
  overflow: auto;
  position: relative;
  margin-top: 30px;
}
.friendTitle {
  margin: 5px 15px;
  position: fixed;
  top: 455px;
}
.con {
  width: 100vw;
  margin-top:30px;
  padding: 0px 15px;
  overflow-y: auto;
}
.con .content {
  padding: 10px 20px;
  border-bottom: solid 1px #ccc;
  vertical-align: middle;
}
.con .content:last-child {
  border-bottom: none;
}
.con .content img {
  width: 45px;
  vertical-align: middle;
  margin-right: 10px;
  border-radius:50% ;
  height: 45px;
}
.con .content button {
  float: right;
  border: none;
  padding: 5px 10px;
  background: #ccc;
  border-radius: 10px;
  margin-top: 10px;
}
.con .content .select {
  background: paleturquoise;
  color: black;
}
/* 尾部 */
.footer {
  width: 100vw;
  height: calc(60px * 0.82);
  background: white;
  position: absolute;
  bottom: 0;
  border-radius: 26px 26px 0px 0px;
  overflow: hidden;
}
.footer div {
  width: 50vw;
  height: calc(60px * 0.82);
  float: left;
  line-height: calc(60px * 0.82);
}
.footer .allPrice {
  padding-left: 26px;
}
.footer .allPrice a {
  font-size: 16px;
  color: #fe0056;
}
.footer .submit {
  background: #fe0056;
  color: white;
  text-align: center;
  font-weight: bold;
}
</style>